"""
@author: yjx
@file: 验证ipv4地址合法性.py
@time: 2023/6/4 22:36
"""
'''
0~255.0~255.0~255.0~255
'''
import re

string = input("请输入你的ip地址:")
ret = re.findall(r"(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}"
               "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$", string)
if ret:
    print("格式正确")
else:
    print("格式错误")
